import {
	createSSRApp
} from "vue";
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import App from "./App.vue";
import { setupI18n } from './locale'
import { themeManager } from './styles/themes'
import './styles/global.scss'

export function createApp() {
	const app = createSSRApp(App);

	// 配置 Pinia
	const pinia = createPinia()
	pinia.use(piniaPluginPersistedstate)
	app.use(pinia)

	// 配置国际化
	const i18n = setupI18n()
	app.use(i18n)

	// 初始化主题
	themeManager.getCurrentTheme()

	return {
		app,
	};
}
